﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using Dapper;
namespace ReferToFriend.Dapper
{
    public class ReferFriendReponsitory : IReferFriendReponsitory
    {
        private IDbConnection _db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

        public bool AddRecord(ReferFriend record)
        {
            //var sqlQuery = "INSERT INTO ReferToFriend (YourEmail,FriendEmail,YourName,PhoneNumber,Comment,IsSendEmailCopy,ReferDate) VALUES(@YourEmail,@FriendEmail,@YourName,@PhoneNumber,@Comment,@IsSendEmailCopy,@ReferDate); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
            //var Id = this._db.Query<int>(sqlQuery, record).Single();
            //return Id > 0;
            return true;
        }


        public List<ReferFriend> GetAll()
        {
            //var sqlQuery = "SELECT Id,YourEmail,FriendEmail,YourName,PhoneNumber,Comment,IsSendEmailCopy,ReferDate FROM ReferToFriend";
            //return this._db.Query<ReferFriend>(sqlQuery).ToList();
            return new List<ReferFriend>();
        }
    }
}